//
//  SSDKPluginToast.h
//  SSDKPluginFramework
//
//  Created by 涂俊 on 2017/7/25.
//  Copyright © 2017年 涂俊. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef enum SSDKPluginToastGravity {
    SSDKPluginToastGravityTop = 1000001,
    SSDKPluginToastGravityBottom,
    SSDKPluginToastGravityCenter
}SSDKPluginToastGravity;

typedef enum SSDKPluginToastDuration {
    SSDKPluginToastDurationLong = 10000,
    SSDKPluginToastDurationShort = 1000,
    SSDKPluginToastDurationNormal = 3000
}SSDKPluginToastDuration;

typedef enum SSDKPluginToastType {
    SSDKPluginToastTypeInfo = -100000,
    SSDKPluginToastTypeNotice,
    SSDKPluginToastTypeWarning,
    SSDKPluginToastTypeError,
    SSDKPluginToastTypeNone // For internal use only (to force no image)
}SSDKPluginToastType;

typedef enum {
    SSDKPluginToastImageLocationTop,
    SSDKPluginToastImageLocationLeft
} SSDKPluginToastImageLocation;


@class SSDKPluginToastSettings;


@interface SSDKPluginToast : NSObject

{
    SSDKPluginToastSettings *_settings;
    NSTimer *timer;
    UIView *view;
    NSString *text;
}

- (void) show;
- (void) show:(SSDKPluginToastType) type;
- (SSDKPluginToast *) setDuration:(NSInteger) duration;
- (SSDKPluginToast *) setGravity:(SSDKPluginToastGravity) gravity
                    offsetLeft:(NSInteger) left
                     offsetTop:(NSInteger) top;
- (SSDKPluginToast *) setGravity:(SSDKPluginToastGravity) gravity;
- (SSDKPluginToast *) setPostion:(CGPoint) position;
- (SSDKPluginToast *) setFontSize:(CGFloat) fontSize;
- (SSDKPluginToast *) setUseShadow:(BOOL) useShadow;
- (SSDKPluginToast *) setCornerRadius:(CGFloat) cornerRadius;
- (SSDKPluginToast *) setBgRed:(CGFloat) bgRed;
- (SSDKPluginToast *) setBgGreen:(CGFloat) bgGreen;
- (SSDKPluginToast *) setBgBlue:(CGFloat) bgBlue;
- (SSDKPluginToast *) setBgAlpha:(CGFloat) bgAlpha;
- (SSDKPluginToast *) setMaxWidth:(CGFloat) maxWidth;
- (SSDKPluginToast *) setMaxHeight:(CGFloat) maxHeight;

+ (SSDKPluginToast *) makeText:(NSString *) text;

- (SSDKPluginToastSettings *) theSettings;

@end


@interface SSDKPluginToastSettings : NSObject<NSCopying>{
    NSInteger duration;
    SSDKPluginToastGravity gravity;
    CGPoint postition;
    CGFloat maxWidth;
    CGFloat maxHeight;
    SSDKPluginToastType toastType;
    CGFloat fontSize;
    BOOL useShadow;
    CGFloat cornerRadius;
    CGFloat bgRed;
    CGFloat bgGreen;
    CGFloat bgBlue;
    CGFloat bgAlpha;
    NSInteger offsetLeft;
    NSInteger offsetTop;
    
    NSDictionary *images;
    
    BOOL positionIsSet;
}


@property(assign) NSInteger duration;
@property(assign) SSDKPluginToastGravity gravity;
@property(assign) CGPoint postition;
@property(assign) CGFloat maxWidth;
@property(assign) CGFloat maxHeight;
@property(assign) CGFloat fontSize;
@property(assign) BOOL useShadow;
@property(assign) CGFloat cornerRadius;
@property(assign) CGFloat bgRed;
@property(assign) CGFloat bgGreen;
@property(assign) CGFloat bgBlue;
@property(assign) CGFloat bgAlpha;
@property(assign) NSInteger offsetLeft;
@property(assign) NSInteger offsetTop;
@property(readonly) NSDictionary *images;
@property(assign) SSDKPluginToastImageLocation imageLocation;


- (void) setImage:(UIImage *)img forType:(SSDKPluginToastType) type;
- (void) setImage:(UIImage *)img withLocation:(SSDKPluginToastImageLocation)location forType:(SSDKPluginToastType)type;
+ (SSDKPluginToastSettings *) getSharedSettings;

@end


